{% extends "base_logged.html" %}
{% block page %}
<div class="row">
  <div class="col-lg-12">
    <h1>Dashboard <small>Statistics Overview</small></h1>
    <ol class="breadcrumb">
      <li class="active"><i class="fa fa-dashboard"></i> Dashboard</li>
    </ol>
  </div>
</div><!-- /.row -->

<div class="row">

  <!-- Minions -->
  {% set minions_down = minions['down']|length > 0 %}
  {% set total_minions = minions['down']|length + minions['up']|length %}
  <div class="col-lg-4">
    <div class="panel {% if minions_down%}panel-danger{% else %}panel-success{% endif %}">
      <div class="panel-heading">
        <div class="row">
          <div class="col-xs-6">
            <i class="fa fa-cloud fa-5x"></i>
          </div>
          <div class="col-xs-6 text-right">
            <div class="huge">{{ minions['up']|length }} / {{ total_minions }}</div>
            <div>Minions are up!</div>
          </div>
        </div>
      </div>
      <a href="{{ url_for('minions_status') }}">
        <div class="panel-footer announcement-bottom">
          <div class="row">
            <div class="col-xs-9">
              Check minion status
            </div>
            <div class="col-xs-3 text-right">
              <i class="fa fa-arrow-circle-right"></i>
            </div>
          </div>
        </div>
      </a>
    </div>
  </div>
  <!-- End of minions -->

  <!-- Out of sync minion -->
  <div class="col-lg-4">
    <div class="panel {% if ok_status == total_minions %}panel-info{% else %}panel-danger{% endif %}">
      <div class="panel-heading">
        <div class="row">
          <div class="col-xs-6">
            <i class="fa fa-refresh fa-5x"></i>
          </div>
          <div class="col-xs-6 text-right">
            <div class="huge">{{ ok_status }} / {{ total_minions }}</div>
            <div>Minions are in sync</div>
          </div>
        </div>
      </div>
      <a href="{{ url_for('minions_status') }}">
        <div class="panel-footer announcement-bottom">
          <div class="row">
            <div class="col-xs-9">
              Check minion sync status
            </div>
            <div class="col-xs-3 text-right">
              <i class="fa fa-arrow-circle-right"></i>
            </div>
          </div>
        </div>
      </a>
    </div>
  </div>
  <!-- End of out of sync minion -->

  <!-- HealthChecks -->
  <!-- <div class="col-lg-3">
    <div class="panel panel-danger">
      <div class="panel-heading">
        <div class="row">
          <div class="col-xs-6">
            <i class="fa fa-plus-square fa-5x"></i>
          </div>
          <div class="col-xs-6 text-right">
            <p class="announcement-heading">10 / 12</p>
            <p class="announcement-text">Healchecks green</p>
          </div>
        </div>
      </div>
      <a href="#">
        <div class="panel-footer announcement-bottom">
          <div class="row">
            <div class="col-xs-6">
              View healthchecks
            </div>
            <div class="col-xs-6 text-right">
              <i class="fa fa-arrow-circle-right"></i>
            </div>
          </div>
        </div>
      </a>
    </div>
  </div> -->
  <!-- End of healthchecks -->

  <!-- <div class="col-lg-3">
    <div class="panel panel-success">
      <div class="panel-heading">
        <div class="row">
          <div class="col-xs-6">
            <i class="fa fa-comments fa-5x"></i>
          </div>
          <div class="col-xs-6 text-right">
            <p class="announcement-heading">56</p>
            <p class="announcement-text">New Orders!</p>
          </div>
        </div>
      </div>
      <a href="#">
        <div class="panel-footer announcement-bottom">
          <div class="row">
            <div class="col-xs-6">
              Complete Orders
            </div>
            <div class="col-xs-6 text-right">
              <i class="fa fa-arrow-circle-right"></i>
            </div>
          </div>
        </div>
      </a>
    </div>
  </div> -->
</div><!-- /.row -->

<!-- <div class="row">
  <div class="col-lg-12">
    <div class="panel panel-primary">
      <div class="panel-heading">
        <h3 class="panel-title"><i class="fa fa-bar-chart-o"></i> Traffic Statistics: October 1, 2013 - October 31, 2013</h3>
      </div>
      <div class="panel-body">
        <div id="morris-chart-area"></div>
      </div>
    </div>
  </div>
</div> -->

<div class="row">
  <!-- <div class="col-lg-4">
    <div class="panel panel-primary">
      <div class="panel-heading">
        <h3 class="panel-title"><i class="fa fa-long-arrow-right"></i> Traffic Sources: October 1, 2013 - October 31, 2013</h3>
      </div>
      <div class="panel-body">
        <div id="morris-chart-donut"></div>
        <div class="text-right">
          <a href="#">View Details <i class="fa fa-arrow-circle-right"></i></a>
        </div>
      </div>
    </div>
  </div> -->
  <div class="col-lg-12">
    <div class="panel panel-primary">
      <div class="panel-heading">
        <h3 class="panel-title"><i class="fa fa-clock-o"></i> Recent Jobs</h3>
      </div>
      <div class="panel-body">
        <div class="list-group">

          {% for jid, job in jobs %}
          <a href="{{ url_for('job_result', jid=jid) }}" class="list-group-item">
            <span class="badge">{{ job.StartTime }}</span>
            <i class="fa fa-calendar"></i> {{ job.Function }} on {{ job.Target }}
          </a>

          {% endfor %}
        <div class="text-right">
          <a href="{{ url_for('jobs') }}">View All Jobs <i class="fa fa-arrow-circle-right"></i></a>
        </div>
      </div>
    </div>
  </div>
  <!-- <div class="col-lg-4">
    <div class="panel panel-primary">
      <div class="panel-heading">
        <h3 class="panel-title"><i class="fa fa-money"></i> Recent Transactions</h3>
      </div>
      <div class="panel-body">
        <div class="table-responsive">
          <table class="table table-bordered table-hover table-striped tablesorter">
            <thead>
              <tr>
                <th>Order # <i class="fa fa-sort"></i></th>
                <th>Order Date <i class="fa fa-sort"></i></th>
                <th>Order Time <i class="fa fa-sort"></i></th>
                <th>Amount (USD) <i class="fa fa-sort"></i></th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>3326</td>
                <td>10/21/2013</td>
                <td>3:29 PM</td>
                <td>$321.33</td>
              </tr>
              <tr>
                <td>3325</td>
                <td>10/21/2013</td>
                <td>3:20 PM</td>
                <td>$234.34</td>
              </tr>
              <tr>
                <td>3324</td>
                <td>10/21/2013</td>
                <td>3:03 PM</td>
                <td>$724.17</td>
              </tr>
              <tr>
                <td>3323</td>
                <td>10/21/2013</td>
                <td>3:00 PM</td>
                <td>$23.71</td>
              </tr>
              <tr>
                <td>3322</td>
                <td>10/21/2013</td>
                <td>2:49 PM</td>
                <td>$8345.23</td>
              </tr>
              <tr>
                <td>3321</td>
                <td>10/21/2013</td>
                <td>2:23 PM</td>
                <td>$245.12</td>
              </tr>
              <tr>
                <td>3320</td>
                <td>10/21/2013</td>
                <td>2:15 PM</td>
                <td>$5663.54</td>
              </tr>
              <tr>
                <td>3319</td>
                <td>10/21/2013</td>
                <td>2:13 PM</td>
                <td>$943.45</td>
              </tr>
            </tbody>
          </table>
        </div>
        <div class="text-right">
          <a href="#">View All Transactions <i class="fa fa-arrow-circle-right"></i></a>
        </div>
      </div>
    </div>
  </div> -->
</div><!-- /.row -->

{% endblock %}
